﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Imaginecup.sprite;
using Microsoft.Xna.Framework.Content;
using Imaginecup.shareData;
using Imaginecup.util.resourceMan;
using Microsoft.Xna.Framework.Graphics;

namespace Imaginecup.gameState.ending.scene.kindOfNormal
{
    public class NormalSpriteLoad:ILoadContent
    {
        private String m_TextureKeyName;
        private String m_SourceName;
        private ContentManager m_Content;

        public NormalSpriteLoad(String TextureKeyName , String SourceName)
        {
            m_TextureKeyName = TextureKeyName;
            m_SourceName = SourceName;
            m_Content = new ContentManager(StateShareData.GetShareData().GetGame().Services);
            m_Content.RootDirectory = "Content";
        }

        public ISprite LoadSprite()
        {
            ResourceMan.GetResourceMan().SetTextureFrame(m_TextureKeyName, m_Content.Load<Texture2D>(m_SourceName));

            NormalSprite normalSprite = new NormalSprite();
            normalSprite.SetTextureName(m_TextureKeyName);
            return normalSprite;
        }


        public void UnloadResource()
        {
            ResourceMan.GetResourceMan().Release(m_TextureKeyName);
            m_Content.Unload();
        }
    }
}
